<!DOCTYPE html>
<html lang="zh-cn" style="height: 100%">
<head>
    <meta charset="UTF-8">
    <title>微软小冰 - 天涯客栈</title>
    <style>
        *{
            margin:0; padding:0;
        }
        body, div, dl, dt, dd, ul, ol, li, h1, h2, h3, h4, h5, h6, pre, code, form, fieldset, legend, input, button, textarea, p, blockquote, th, td { margin: 0; padding: 0;  font-family: "微软雅黑"; }
        fieldset, img { border: 0; }
        ul, ol, li { list-style: none; font-family:'Microsoft YaHei'; }

        /* remember to define focus styles! */
        :focus { outline: 0; }
    </style>
</head>
<body style="height: 100%">
    <iframe src="http://blog.321aiyi.com/search?q=天涯客栈" id="chat" style="width: 100%;height: 100%;border: none"></iframe>
    <script>
        document.getElementById("chat").onload = function (){
            let chat = document.getElementById("chat").contentWindow.document;
            init(chat);
        }

        function init(chat){
            if (!chat.getElementById("ev_talkbox_max")){
                setTimeout(() => {
                    init(chat);
                }, 100)
            }else{
                // 此处初始化页面
                openChat(chat);
                remove(chat.getElementById("b_header"));
                remove(chat.getElementsByTagName("main")[0])
                remove(chat.getElementsByTagName("aside")[0])
                remove(chat.getElementsByTagName("footer")[0])
                let box = chat.getElementById("ev_talkbox_wrapper");
                box.style.top = '0';
                box.style.left = '0';
                box.style.right = '0';
                box.style.bottom = '0';
                chat.getElementById("ev_talkbox_max").style.width = '100%';
                chat.getElementById("ev_talkbox_max").style.height = '100%';

                chat.getElementsByTagName("html")[0].style.height = '100%';
                chat.getElementsByTagName("html")[0].style.overflow = 'hidden';
                chat.body.style.height = '100%';
                let contextBox = chat.getElementById("ev_talkbox");
                contextBox.style.maxHeight = '100%';
                contextBox.style.height = "calc(100% - 71px)";

                // 去掉顶栏
                remove(chat.getElementById("ev_talkbox_wrapper").getElementsByClassName("ev_tb_header")[0])

                chat.getElementById("ev_send_text").style.width = "calc(100% - 100px)"
            }
        }

        function openChat(chat){
            return chat.getElementById("ev_talkbox_min").click();
        }

        /**
         * 移除页面某个元素
         * @param element
         */
        function remove(element){
            if (element && element.parentElement){
                element.parentElement.removeChild(element);
            }
        }

    </script>
</body>
</html>